<%@page import="sedev.shopping.entities.ListDonViGia"%>
<%@page import="sedev.shopping.entities.ListLoaiSanPham"%>
<%@ include file="/init.jsp" %>
<%@include file="../script.jsp" %>

<%
	ListLoaiSanPham listloaisanpham = (ListLoaiSanPham)request.getAttribute("listloaisanpham");	
	ListDonViGia listdonvigia = (ListDonViGia)request.getAttribute("listdonvigia");
	Long currentdate = (Long)request.getAttribute("currentdate"); 
%>
<div class="menu-box">
	<%@include file="../menu.jsp" %>
</div>
<div id="content-box">
	<div class="padding">
    	<div id="toolbar-box">
       	<div class="t">
           	<div class="t">
               	<div class="t"></div>
           	</div>
       	</div>
	       	<div class="m">
	           	<div id="toolbar" class="toolbar">
		           	<table class="toolbar">
		            	<tbody>
		                	<tr>
								<td id="toolbar-save" class="button">
									<a class="toolbar" href="javascript:void(0)" onclick="shopping.postFormProduct('adminform')">
										<span title="Save" class="icon-32-save"></span>
										<liferay-ui:message key="label-save" />
									</a>
								</td>
								<td id="toolbar-cancel" class="button">
								    <a class="toolbar" href='<s:url action="product"></s:url>'>
										<span title="Cancel" class="icon-32-cancel"></span>
										<liferay-ui:message key="label-cancel" />
								    </a>
								</td>
		                	</tr>
		            	</tbody>
	        		</table>
	           	</div>
				<div class="header icon-48-article">
				    <liferay-ui:message key="label-add-product" />
				</div>
				<div class="clr"></div>
	       	</div>
	       	<div class="b">
	           	<div class="b">
	               	<div class="b"></div>
	           	</div>
	       	</div>
    	</div>
    	<div id="element-box">
	        <div class="t">
	           <div class="t">
	               <div class="t"></div>
	           </div>
	        </div>
	        <div class="m">
				<form action='<s:url action="addProduct"></s:url>' method="post" id="adminform" name="adminform">
				    <table width="100%">
						<tr>
							<td width="12%">
								<label><liferay-ui:message key="label-product-code" /> :</label>
							</td>
							<td width="50%">
						    	<input id="productcode" type="text" name="productcode" value="" size="20" maxlength="255"/>
						    </td>
						 	<td width="12%"></td>
						    <td></td>
						</tr>
			        	<tr>
			            	<td>
				                <label><liferay-ui:message key="label-product-name" /> :</label>
				            </td>
				            <td>
				                <input id="title" type="text" name="title" value="" size="50" maxlength="255"/>
				            </td>				           
				            <td>
				            	<label><liferay-ui:message key="label-price" /> :</label>
				            </td>
				            <td>
				                <input type="text" id="price" name="price" size="40" value="" />
				            </td>
				        </tr>				        
				        <tr>
				            <td>
				                <label><liferay-ui:message key="label-product-type" /></label>
				            </td>
				            <td>
				                <select id="producttype" name="producttype" style="width: 150px" onchange="shopping.changeSelectProductType(this,'showAttribute')">
				                    <option value="0">- <liferay-ui:message key="label-choose-product-type" /> -</option>
				                    <%
				                    if(listloaisanpham!=null && listloaisanpham.size()>0){
				                    	for(int index=0; index<listloaisanpham.size();++index){%>
				                    		<option value="<%= listloaisanpham.get(index).getId()%>">
				                    		<%= listloaisanpham.get(index).getTen()%>				              
				                    		</option>
				                    	<%}
				                    }
				                    %>	                    
				                </select>
				                <%
				                    if(listloaisanpham!=null && listloaisanpham.size()>0){
				                    	for(int index=0; index<listloaisanpham.size();++index){%>
				                    		<div id="data_attribute<%= listloaisanpham.get(index).getId()%>" style="display:none">
				                    			<%= listloaisanpham.get(index).getThuocTinh()%>				              
				                    		</div>
				                    	<%}
				                    }
				                    %>	
				            </td>
				            <td>
				                <label><liferay-ui:message key="label-price-sale" /> :</label>
				            </td>
				            <td>
				                <input type="text" id="pricesale" name="pricesale" size="40" value="" />
				            </td>
				        </tr>
				        <tr>
				         	<td>
				                <label><liferay-ui:message key="label-publish" /> :</label>                                         
				            </td>
				        	<td>
				                <input type="radio" value="0" name="published" /><label><liferay-ui:message key="label-hide" /></label>
				                <input type="radio" value="1" name="published" checked="checked"/><label><liferay-ui:message key="label-display" /></label>
				            </td>
				            <td>
				                <label><liferay-ui:message key="label-unit-currency" /> :</label>
				            </td>
				            <td>
				            	<select id="unitcurrency" name="unitcurrency">				            		
				            		<%
				                    if(listdonvigia != null && listdonvigia.size()>0){
				                    	for(int index=0; index<listdonvigia.size();++index){%>
				                    		<option value="<%= listdonvigia.get(index).getTen()%>">
				                    		<%= listdonvigia.get(index).getTen()%>				              
				                    		</option>
				                    	<%}
				                    }
				                    %>
				            	</select>
				            </td>
				        </tr>
				        <tr>
				        	<td>
				                <label><liferay-ui:message key="label-create-date" />:</label>
				            </td>
				            <td>
				                <input id="date" name="date" type="text" value="<%=SedevUtil.parseDateToString(currentdate,"MM/dd/yyyy") %>" size="20"/>				               
				                <script type="text/javascript">				                	
				                </script>
				            </td>
				            <td>
				                <label><liferay-ui:message key="label-have-vat" /> :</label>
				            </td>
				            <td>
				            	<input type="checkbox" name="productvat" />
				            </td>
				        </tr>
				        <tr>
				        	<td>
				                <label><liferay-ui:message key="label-date-expire" />:</label>
				            </td>
				            <td>
				                <select id="timeexpire" name="timeexpire">
				                	<option value="0"><liferay-ui:message key="label-never-expire" /></option>
				                	<option value="15">15 <liferay-ui:message key="label-date" /></option>
				                	<option value="30">30 <liferay-ui:message key="label-date" /></option>
				                	<option value="60">60 <liferay-ui:message key="label-date" /></option>
				                </select>
				            </td>
				           <% if(renderRequest.isUserInRole("administrator")){%>
							<td>
							  	<label><liferay-ui:message key="label-vip" /> :</label>
							</td>
							<td>
							    <input type="checkbox" name="productspecial" />
							</td>
				            <%} %>
				        </tr>
				        <tr>
				        	<td><liferay-ui:message key="label-attribute" /></td>
				        	<td>
				        		<div class="shopping_note"><liferay-ui:message key="label-note-attribute" /></div>
				        	</td>				        	
				        </tr>
				        <tr>
				            <td></td>
				            <td>				            	
				            	<div id="showAttribute">
								</div>
								<input type="hidden" name="attribute" id="attribute" />
				            </td>
				        </tr>
				        <tr>
				            <td>
				                <label><liferay-ui:message key="label-product-content" /> :</label>
				            </td>
				            <td colspan="2">           
				               <liferay-ui:input-editor width="100%" name="sedevShoppingProductContent" initMethod="sedevShoppingProductContent_initEditor">
				               </liferay-ui:input-editor>
				               <input type="hidden" id="productcontent" name="productcontent" value="no content" />				               	               			               
				            </td>                                     
				        </tr>
				        <tr>
				            <td>
				                <label><liferay-ui:message key="label-product-image" /> :</label>
				            </td>
				            <td colspan="2">           
				               <liferay-ui:input-editor width="100%" name="sedevShoppingProductImage" initMethod="sedevShoppingProductImage_initEditor">
				               </liferay-ui:input-editor>
				               <input type="hidden" id="productimage" name="productimage" value="no image" />				               	               			               
				            </td>                                     
				        </tr>
				    </table>				    
				</form>
	        </div>
	        <div class="b">
	           <div class="b">
	               <div class="b"></div>
	           </div>
	        </div>
	    </div>
	</div>
</div>

<aui:script>	
	function sedevShoppingProductContent_initEditor() {	
		return '';
	}
	function sedevShoppingProductImage_initEditor(){
		return '';
	}
</aui:script>
<script type="text/javascript" language="javascript">
	/* window.addEvent('domready', function() {
	    new Picker.Date('showdate', {
	        pickerClass: 'datepicker_vista'
	    });
	}); */
	$(function() {
		$( "#date" ).datepicker();
	});
</script>